<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>喜欢的水果： 
        <label><input type="checkbox" value="苹果" />苹果</label>
        <label><input type="checkbox" value="西瓜" checked="checked" />西瓜</label>
        <label><input type="checkbox" value="蜜桃" />蜜桃</label>
    </p>
    <script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
    <script>

        $("input").click(function(){
            var inputArr = $(":checked");
            $("p").text("选中的个数="+inputArr.length)
         })
    </script>
</body>
</html>